﻿<phone:PhoneApplicationPage
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
                            xmlns:ext="clr-namespace:WPExtensions;assembly=WPExtensions"
                            xmlns:Coding4Fun_Phone_Controls_Converters="clr-namespace:Coding4Fun.Phone.Controls.Converters;assembly=Coding4Fun.Phone.Controls" x:Class="ScheduleMVVM.RoutePage"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="768"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True"
                            Loaded="PhoneApplicationPage_Loaded">
    <phone:PhoneApplicationPage.Resources>
        <Coding4Fun_Phone_Controls_Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <DataTemplate x:Key="DataEntryTemplate">
            <Grid Height="80" Width="480">
                <RichTextBox Margin="80,10,0,0" VerticalAlignment="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" TextAlignment="Center" FontSize="18.667" TextWrapping="NoWrap">
                    <Paragraph>
                        <Run Text="{Binding RouteString}"/>
                    </Paragraph>
                </RichTextBox>
                <RichTextBox HorizontalAlignment="Left" Margin="110,0,0,10" TextAlignment="Center" VerticalAlignment="Bottom">
                    <Paragraph>
                        <Run Text="{Binding ArrivalTimeString}"/>
                    </Paragraph>
                </RichTextBox>
                <RichTextBox Margin="199,0,0,10" TextAlignment="Center" VerticalAlignment="Bottom" Foreground="{Binding FocusColor, Mode=OneWay}">
                    <Paragraph>
                        <Run Text="{Binding DepartsInString}"/>
                    </Paragraph>
                </RichTextBox>
                <RichTextBox HorizontalAlignment="Left" Margin="10,21,0,21" FontSize="24" VerticalScrollBarVisibility="Disabled" TextWrapping="NoWrap" IsReadOnly="True" Foreground="{Binding FocusColor, Mode=OneWay}">
                    <Paragraph>
                        <Run Text="{Binding DepartureTimeString}"/>
                    </Paragraph>
                </RichTextBox>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </phone:PhoneApplicationPage.Foreground>
    <phone:PhoneApplicationPage.DataContext>
        <Binding Path="Route" Source="{StaticResource Locator}"/>
    </phone:PhoneApplicationPage.DataContext>
    <shell:SystemTray.ProgressIndicator >
        <shell:ProgressIndicator IsIndeterminate="{Binding ProgressIndicatorStatus}" IsVisible="True" Text="{Binding ProgressIndicatorText}" x:Name="progressBar"/>
    </shell:SystemTray.ProgressIndicator>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel"
                    Grid.Row="0"
                    Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle"
                       Text="{Binding ApplicationTitle}"
                       Style="{StaticResource PhoneTextNormalStyle}" />
            <TextBlock x:Name="PageTitle"
                       Text="{Binding PageTitle}"
                       Margin="9,-7,0,0"
                       Style="{StaticResource PhoneTextTitle1Style}" />
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid Margin="0,150,0,0">
            <Grid Height="50" VerticalAlignment="Top" DataContext="{Binding LinkedFavourite}">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <RichTextBox HorizontalAlignment="Left" AcceptsReturn="False" VerticalScrollBarVisibility="Disabled" TextWrapping="NoWrap" HorizontalScrollBarVisibility="Auto" BorderThickness="0" Margin="-12,0,0,0" Foreground="White">
                        <RichTextBox.Background>
                            <SolidColorBrush Color="{StaticResource Mango Leaf Green}"/>
                        </RichTextBox.Background>
                        <Paragraph>
                            <Run Text="{Binding DepartureStationTitle}"/>
                        </Paragraph>
                    </RichTextBox>
                    <es:RegularPolygon InnerRadius="1" Margin="-17,0,0,0" PointCount="3" Stretch="Fill" UseLayoutRounding="False" Width="50" Height="40" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
                        <es:RegularPolygon.RenderTransform>
                            <CompositeTransform Rotation="90"/>
                        </es:RegularPolygon.RenderTransform>
                        <es:RegularPolygon.Fill>
                            <SolidColorBrush Color="{StaticResource Mango Leaf Green}"/>
                        </es:RegularPolygon.Fill>
                    </es:RegularPolygon>
                </StackPanel>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0" d:LayoutOverrides="HorizontalAlignment">
                    <es:RegularPolygon InnerRadius="1" Margin="0,0,-17,0" PointCount="3" Stretch="Fill" UseLayoutRounding="False" Width="50" RenderTransformOrigin="0.5,0.5" Height="40" HorizontalAlignment="Right">
                        <es:RegularPolygon.RenderTransform>
                            <CompositeTransform Rotation="-90"/>
                        </es:RegularPolygon.RenderTransform>
                        <es:RegularPolygon.Fill>
                            <SolidColorBrush Color="{StaticResource Mango Leaf Green}"/>
                        </es:RegularPolygon.Fill>
                    </es:RegularPolygon>
                    <RichTextBox HorizontalAlignment="Right" AcceptsReturn="False" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" TextWrapping="NoWrap" Margin="0,0,-12,0" Foreground="White">
                        <RichTextBox.Background>
                            <SolidColorBrush Color="{StaticResource Mango Leaf Green}"/>
                        </RichTextBox.Background>
                        <Paragraph>
                            <Run Text="{Binding ArrivalStationTitle}"/>
                        </Paragraph>
                    </RichTextBox>
                </StackPanel>
            </Grid>
            <ListBox ItemTemplate="{StaticResource DataEntryTemplate}" Margin="0,50,0,0" ItemsSource="{Binding Result}" Height="568" />
            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding ErrorMessage, Mode=OneWay}" VerticalAlignment="Top" FontSize="24" Margin="70,70,0,0">
            	<TextBlock.Foreground>
            		<SolidColorBrush Color="{StaticResource Twitter Blue}"/>
            	</TextBlock.Foreground>
            </TextBlock>
        </Grid>
        <ext:AdvancedApplicationBar BackgroundColor="{StaticResource Twitter Blue}" x:Name="AdvancedAppBar">
            <ext:AdvancedApplicationBarIconButton IconUri="/icons/appbar.pin.rest.png" Command="{Binding LinkedFavourite.PinEntryCommand, Mode=OneWay}" Text="{Binding PinAppBarIconString, Mode=OneWay}" />
            
            <ext:AdvancedApplicationBarMenuItem Command="{Binding DeleteFavouriteAndExitViewCommand, Mode=OneWay}" Text="{Binding DeleteAppBarIconString, Mode=OneWay}" Margin="0,0,28,0"/>
            <ext:AdvancedApplicationBarMenuItem Text="{Binding EditAppBarIconString, Mode=OneWay}" Command="{Binding LinkedFavourite.EditFavouriteCommand, Mode=OneWay}" Margin="0,0,18,0"/>
        </ext:AdvancedApplicationBar>

    </Grid>

</phone:PhoneApplicationPage>